﻿@using Microsoft.AspNet.Identity
@model SocialGoal.Web.ViewModels.UserProfileFormModel
@{
   
}
<strong>
    Edit Your BasicInfo</strong>
<div id="edit" class="span12">
    @using (Html.BeginForm("EditProfile","Account"))
    {
        
        <table class ="table">
            <tr>
                <td style="width:150px;">
                    <label>
                        First Name:</label>
                </td>
                <td>@Html.TextBoxFor(m => m.FirstName, new { @class = "span11" })
                    @Html.ValidationMessageFor(model => model.FirstName)
                </td>
            </tr>
            <tr>
                <td>
                    <label>
                        Last Name:</label>
                </td>
                <td>@Html.TextBoxFor(m => m.LastName, new { @class = "span11" })
                    @Html.ValidationMessageFor(model => model.LastName)
                </td>
            </tr>
            <tr>
                <td>
                    <label>
                        Email:</label>
                </td>
                <td>@Html.TextBoxFor(m => m.Email, new { @class = "span11"  })
                    @Html.ValidationMessageFor(model => model.Email)
                </td>
            </tr>
            <tr>
                <td>
                    <label>
                        Date Of Birth:</label>
                </td>
                <td> @if (Model.DateOfBirth.HasValue)
                     { 
                    @Html.TextBoxFor(m => m.DateOfBirth, String.Format("{0:d}", Model.DateOfBirth) ,new { @class = "ui-datepicker span11", @style = "display:block;float:left;" })
                    @Html.ValidationMessageFor(model => model.DateOfBirth)
                     }
                     else
                     { 
                    @Html.TextBoxFor(m => m.DateOfBirth, new { @value = "", @class = "ui-datepicker span11", @style = "display:block;float:left;" ,@readonly="readonly"})
                     }
                </td>
            </tr>
            <tr>
                <td>
                    <label>Gender:</label>
                </td>
                <td>

                    @if (Model.Gender == true)
                    {
                        @Html.RadioButtonFor(model => model.Gender, false) <text>Male</text>
                        @Html.RadioButtonFor(model => model.Gender, true, new { @checked = "checked" })<text> Female</text>
                    }
                    else if (Model.Gender == false)
                    {
                        @Html.RadioButtonFor(model => model.Gender, false, new { @checked = "checked" })<text> Male</text>
                        @Html.RadioButtonFor(model => model.Gender, true)<text> Female</text>
                    }
                    else
                    {
                        @Html.RadioButtonFor(model => model.Gender, false)<text> Male</text>
                        @Html.RadioButtonFor(model => model.Gender, true)<text> Female</text>
                    }
                </td>
            </tr>
        </table>
        
   
                @Html.HiddenFor(m => m.UserProfileId)
                @Html.HiddenFor(m => m.UserId)
                @Html.HiddenFor(m => m.Address)
                @Html.HiddenFor(m => m.City)
                @Html.HiddenFor(m => m.ContactNo)
                @Html.HiddenFor(m => m.Country)
                @Html.HiddenFor(m => m.State)
                @Html.HiddenFor(m => m.ZipCode)

                
         
        
        <button class="btn btn-primary" type="submit" value="Save">
            Save</button>
        <button class="btn" type="reset" value="Cancel" onclick="window.location.href='@Url.Action("UserProfile", "Account", new { id = (User.Identity.GetUserId()) })'">
            Cancel</button>
    }
</div>

<script type="text/javascript">
    $(document).ready(function () {
        $('.ui-datepicker').each(function (i, v) {

            $(".ui - datepicker").val(" ");
            //$(v).val($.datepicker.formatDate('dd-M-yy', new Date($(v).val())))
            $(v).datepicker({
                dateFormat: 'dd-M-yy', 
                changeYear: true,
                yearRange: '1950:2010',
                buttonImage: '@Url.Content("~/Content/calendar.gif")',
                buttonImageOnly: true,
                showOn: "button"
            });
        });
    });

</script>
